from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from ims.sti.models import Topic
from django.contrib.sitemaps import GenericSitemap


infoDict = {
    'queryset': Topic.objects.all(),
}

sitemaps = {
    'topics': GenericSitemap(infoDict),
}

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),                       
    (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap',
        {'sitemaps': sitemaps}),
    (r'^topics/(?P<topicName>.+)/$', 'ims.sti.views.topic'),
    (r'^topics/$', 'ims.sti.views.topicIndex'),
    (r'^people/$', 'ims.sti.views.personIndex'),
    (r'^$', 'ims.sti.views.home'),
    (r'^search/$', 'ims.sti.views.search'),
    (r'^courses/$', 'ims.sti.views.courseIndex'),
    (r'^courses/(?P<courseName>[^/]+)/$', 'ims.sti.views.course'),
    (r'^courses/(?P<courseName>[^/]+)/(?P<choice>[^/]+)/$', 'ims.sti.views.course'),
    (r'^redirect/(?P<ext_url>.+)/$','ims.sti.views.redirect'),
	(r'^books/$', 'ims.sti.views.bookIndex'),
	(r'^books/(?P<bookName>.+)/$', 'ims.sti.views.book'),
	(r'^about/$', 'ims.sti.views.about')


)

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^(?P<path>(stylesheets|images)/.*)$', 
            'django.views.static.serve', 
            # {'document_root': '/home/jeff/stat/www/static'}),)
            {'document_root': '/home/www-data/www/static'}),)

